// 全局过滤器

import Vue from 'vue'
import methods from '@/business/utils/methods.js'
import formatter from '@/libs/framework/formatter.js'

// 字典查询
Vue.filter('fltDic', (targetKey, dic = [], keyName = 'key', valueName = 'value') => {
    return methods.fnQueryDic(targetKey, dic, keyName, valueName)
})

// 前缀添加
Vue.filter('fltPrefix', (value, prefix) => {
    return prefix + value + ''
})

// 后缀添加
Vue.filter('fltSuffix', (value, suffix) => {
    return value + suffix + ''
})

// 添加框架中formatter.js对应的过滤器
Vue.filter('fltFormatter', (value, name, params) => {
    return formatter[name](value, params)
})